// 封装所有请求操作
import axios from '../../index'



//部门设置接口
export const departmentSetAxios = () => {
    return axios({
        url: '/employee/queryDept1',
        method: 'GET',
        params: {

        }
    })
}

// 角色权限接口
export const roleBasedAxios = () => {
    return axios({
        url: '/employee/queryRole1',
        method: 'GET',
        params: {}
    })
}

// 员工列表接口
export const staffListAxios = (limit, page) => {
    return axios({
        url: '/employee/queryEmployeePage',
        method: 'GET',
        params: {
            limit,
            page
        },
    })
}

//新增部门
export const addDepAxios = (dept_name) => {
    return axios({
        url: '/employee/addDept',
        method: 'POST',
        data: {
            "dept_id": 0,
            "dept_name": dept_name,
        }
    })
}

//部门设置-修改
export const alterDepAxios = (arr) => {
    return axios({
        url: '/employee/updateDept',
        method: 'POST',
        data: {
            "dept_id": arr.dept_id,
            "dept_name": arr.dept_name
        }
    })
}

//删除部门(部门设置板块)
export const delDepAxios = (dept_name) => {
    return axios({
        url: '/employee/delDept',
        method: 'POST',
        data: {
            "dept_name": dept_name,
        }
    })
}


//角色权限-删除
export const delRoleAxios = (role_name) => {
    return axios({
        url: '/employee/delRole',
        method: 'POST',
        data: {
            "role_name": role_name,
        }
    })
}


//新增员工
export const addStaffAxios = (form) => {
    return axios({
        url: '/employee/addEmployee',
        method: 'POST',
        // data: {
        //   "dept_id": 0,
        //   "employee_birthday": "2021-12-13T07:05:02.941Z",
        //   "employee_clientlimit": 0,
        //   "employee_email": "string",
        //   "employee_login": "string",
        //   "employee_name": "string",
        //   "employee_password": "string",
        //   "employee_role": "string",
        //   "employee_sal": "string",
        //   "employee_sex": 0,
        //   "employee_tel": 0,
        // },
        data: {
            "dept_id": form.dept_id,
            "employee_birthday": form.employee_birthday,
            "employee_clientlimit": form.employee_clientlimit,
            "employee_email": form.employee_email,
            "employee_login": form.employee_login,
            "employee_name": form.employee_name,
            "employee_password": form.employee_password,
            "employee_role": form.role_name,
            "employee_sal": form.employee_sal,
            "employee_sex": form.employee_sex,
            "employee_tel": form.employee_tel,
            "employee_id": form.employee_role,
        }
    })
}

// 新增员工-部门下拉
export const addDepSelectAxios = () => {
    return axios({
        url: '/employee/queryDept1',
        method: 'GET',
        params: {
            dept_id: '',
            dept_name: ''
        }
    })
}


// 新增员工-权限下拉
export const addDepRoleAxios = () => {
    return axios({
        url: '/employee/queryRole1',
        method: 'GET',
        params: {
            role_id: '',
            role_name: '',
        }
    })
}

// 获取权限值接口
export const authorityAxios = () => {
    return axios({
        url: '/employee/queryAnthority',
        method: 'POST',
        data: {

        }
    })
}

// 新增权限接口
export const addPermissionsAxios = (role_name, anthority_name) => {
    return axios({
        url: '/employee/addRole',
        method: 'POST',
        data: {
            role_name,
            anthority_name
        }
    })
}

// 修改权限接口
export const alterPermissionsAxios = (role_name,anthority_name) => {
    return axios({
        url: '/employee/delAnthority',
        method: 'POST',
        data: {
            role_name,
            anthority_name
        }
    })
}

// 获取某一个角色的权限
export const someOnePermissionsAxios = (role_name) =>{
    return axios({
        url: '/employee/queryAnthority',
        method: 'POST',
        data:{
            role_name
        }
    })
}

//员工列表-删除
export const delStaffListAxios = (employee_login) => {
    return axios({
        url: '/employee/delEmployee',
        method: 'POST',
        data: {
            "employee_login": employee_login,
        }
    })
}
